Field of the Invention
The present invention relates to a technology of calculating the distance to a subject from a plurality of images that are photographed while photographing conditions are changed.
Description of the Related Art
As a method of acquiring the distance in the depth direction from two-dimensional images acquired by an image pickup apparatus to a subject in the images, there is proposed a depth from defocus (DFD) method as disclosed in Japanese Patent Application Laid-open No. H01(1989)-167610. In the DFD method, a plurality of images whose blur amounts are different are acquired by controlling the photographing condition (also referred to as a photographing parameter) of the imaging optical system, and the size of the blur in each image or a correlation amount of blurs between the images is calculated by using a pixel to be measured and pixels around the pixel.
Since the size of the blur or the correlation amount is changed according to the distance (depth) of the subject in the image, the distance can be calculated by using this relation. In distance measurement by the DFD method, the distance can be calculated by a single imaging system, and therefore, there is an advantage that the distance measurement can be incorporated in an image pickup apparatus of a consumer product such as a compact digital camera.
In the conventional DFD method, by utilizing the change in size of blurs by the imaging optical system according to the distance to the subject, the distance of the subject is estimated on the basis of the size of blurs of a plurality of images. At this time, when the photographing condition of each image is known, the distance can be calculated in theory, and therefore, a preferred photographing condition is not mentioned in Japanese Patent Application Laid-open No. H01(1989)-167610. However, as the present inventors discovered, it is found that how to set the photographing condition of each image influences the estimation accuracy (measurement accuracy) of the distance, or the size of a measurable distance range.